import request from '@/utils/request'

export const menuService = {
  // 获取菜单列表
  getMenus(params) {
    return request({
      url: '/menus',
      method: 'get',
      params
    })
  },
  
  // 获取菜单详情
  getMenuDetail(id) {
    return request({
      url: `/menus/${id}`,
      method: 'get'
    })
  },
  
  // 创建菜单
  createMenu(data) {
    return request({
      url: '/menus',
      method: 'post',
      data
    })
  },
  
  // 更新菜单
  updateMenu(id, data) {
    return request({
      url: `/menus/${id}`,
      method: 'put',
      data
    })
  },
  
  // 删除菜单
  deleteMenu(id) {
    return request({
      url: `/menus/${id}`,
      method: 'delete'
    })
  },
  
  // 获取菜单树
  getMenuTree() {
    return request({
      url: '/menus/tree',
      method: 'get'
    })
  },
  
  // 获取用户菜单
  getUserMenus() {
    return request({
      url: '/menus/user',
      method: 'get'
    })
  }
}